//
//  UserCenterViewController.m
//  CPetro
//
//  Created by ggx on 2017/3/8.
//  Copyright © 2017年 高广校. All rights reserved.
//

#import "UserCenterViewController.h"

#import "BlogTableViewHelper.h"


@interface UserCenterViewController ()
{
    __weak IBOutlet CGTableView_loadView2 *_tableView;
}
@property (strong, nonatomic) BlogTableViewHelper *blogTableViewHelper;
@end

@implementation UserCenterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationItemTitle = @"我的";
    
    __weak typeof(self) weakSelf = self;
    //所有的店员加载 View
    self.blogTableViewHelper = [BlogTableViewHelper helperWithTableView:_tableView userId:1];
    self.blogTableViewHelper.didSelectRowAtPushViewIndexPath = ^(NSInteger tag){
        if (tag == 100) {
            [CustomUtil delAcessToken];//删除 token
            [weakSelf.navigationController pushViewController:CreateViewController(@"LoginViewController") animated:YES];
        }else{
            [weakSelf pushCenterViewController:tag];
        }
    };

}
#pragma mark - view control
-(void)pushCenterViewController:(NSInteger)pushIndex{
    switch (pushIndex) {
        case 2:
            PushViewControllerName(@"ChangeTelViewController");
            break;
        case 3:
            PushViewControllerName(@"MyAssistantViewController");
            break;
        case 4:
//            PushViewControllerName(@"HistorryOrderViewController");
//            break;
        case 5:
//            PushViewControllerName(@"MessagerViewController");
            break;
        case 6:
            PushViewControllerName(@"ChangePwdViewController");
            break;
        case 7:
            PushViewControllerName(@"FeedBackViewController");
            break;
        case 8:
            PushViewControllerName(@"AboutOurViewController");
            break;
        default:
            //清除缓存
            [[HUDHelper sharedInstance]syncLoading:@"清除缓存"];
            
            [[HUDHelper sharedInstance]syncStopLoading];
            
//            [HUDHelper alert:@"清除缓存" cancel:@"OK"];
            
            break;
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
